import React, { useContext } from 'react';
import { Input } from 'antd';
import { StatusContext } from '@/views/MaterialsView/context';

interface EditorProps {
  configKey: string;
  id: string;
  status: string;
  isShow: boolean;
  editCom: React.FC<any>; // 假设editCom是一个React组件类型
}

const TitleEditor: React.FC<EditorProps> = ({ id, configKey, status }) => {
  // console.log('渲染标题', status);
  // const [text, setText] = useState(status);
  const { updateStatus } = useContext(StatusContext);
  const inputHandle = (e: React.ChangeEvent<HTMLElement>) => {
    const val = e.target.value;
    console.log(val);
    // setText(val);
    updateStatus(configKey, val);
  };

  return (
    <div key={id}>
      <div className="m-b-2">标题内容</div>
      <Input value={status} onChange={inputHandle} placeholder="请输入标题" />
    </div>
  );
};

export default TitleEditor;
